package com.codingapi.modificial.os.osinfo;

import com.codingapi.modificial.os.entity.SigarInfoEntity;
import org.hyperic.sigar.OperatingSystem;

import java.util.ArrayList;
import java.util.List;

/**
 * @author modificial
 * @date 2018/5/16
 * @company codingApi
 * @description
 */
public class OSTools {

    /**
     * 4.获取操作系统信息
     *
     * @return
     */
    public static List<SigarInfoEntity> getOsInfos() {
        List<SigarInfoEntity> osInfoList = new ArrayList<SigarInfoEntity>();
        OperatingSystem os = OperatingSystem.getInstance();
        osInfoList.add(new SigarInfoEntity(os.getArch(), "操作系统"));
        osInfoList
                .add(new SigarInfoEntity(os.getCpuEndian(), "操作系统CpuEndian()"));
        osInfoList
                .add(new SigarInfoEntity(os.getDataModel(), "操作系统DataModel()"));
        osInfoList.add(new SigarInfoEntity(os.getDescription(), "操作系统的描述"));
        osInfoList.add(new SigarInfoEntity(os.getVendor(), "操作系统的供应商"));
        osInfoList
                .add(new SigarInfoEntity(os.getVendorCodeName(), "操作系统的供应商编号"));
        osInfoList.add(new SigarInfoEntity(os.getVendorName(), "操作系统的供应商名称"));
        osInfoList.add(new SigarInfoEntity(os.getVendorVersion(), "操作系统供应商类型"));
        osInfoList.add(new SigarInfoEntity(os.getVersion(), "操作系统的版本号"));
        return osInfoList;
    }

    public static void main(String[] args) {
        System.out.println(getOsInfos());
    }
}
